/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__jolt_destroy_stmt.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2016/03/01 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"

#include "../../../src/module/tuxedojolt/config.h"
#include "../test_jolt_comm.h"
#include <tuxedojolt/jolt_core.h>
#include <tuxedojolt/jolt_header.h>
#include <tuxedojolt/jolt_comm.h>
#include <tuxedojolt/jolt_packet.h>
#include <frct_comm.h>

extern void __jolt_destroy_stmt(L7_jolt_stmt **pp_st_jolt_stmt);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{
    L7_jolt_stmt *p_st_jolt_stmt = NULL;
    p_st_jolt_stmt = (L7_jolt_stmt *) frmalloc(sizeof(L7_jolt_stmt));
    CU_ASSERT_PTR_NOT_NULL(p_st_jolt_stmt);
    memset(p_st_jolt_stmt, 0x00, sizeof(L7_jolt_stmt));

    __jolt_destroy_stmt(&p_st_jolt_stmt);
    CU_ASSERT_PTR_NULL(p_st_jolt_stmt);
}

static void __case2(void)
{
    L7_jolt_stmt *p_st_jolt_stmt = NULL;
    __jolt_destroy_stmt(&p_st_jolt_stmt);
    CU_ASSERT_PTR_NULL(p_st_jolt_stmt);
}

int add_suite__jolt_destroy_stmt(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __jolt_destroy_stmt()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL ||
        CU_add_test(pSuite, "case2", __case2) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
